using System.Windows.Media;
using Common;
using Common.NotifyEvent;

namespace ProjectView.ProjectControls
{
    public class AQTargetDataRow : NotifyPropertyChanged
    {
        private object _ColumnItem = "";

        private object _Channel1 = "";

        private object _Channel2 = "";

        private object _Channel3 = "";

        private object _Channel4 = "";

        private object _Channel5 = "";

        private object _Channel6 = "";

        private Color _Color1 = Colors.Black;

        private Color _Color2 = Colors.Black;

        private Color _Color3 = Colors.Black;

        private Color _Color4 = Colors.Black;

        private Color _Color5 = Colors.Black;

        private Color _Color6 = Colors.Black;

        private int _TubeNo;

        public object ColumnItem
        {
            get
            {
                return _ColumnItem;
            }
            set
            {
                if (value == null)
                {
                    _ColumnItem = "";
                }
                else
                {
                    _ColumnItem = value;
                }
                OnPropertyChanged("ColumnItem");
            }
        }

        public object Channel1
        {
            get
            {
                return _Channel1;
            }
            set
            {
                if (value == null)
                {
                    _Channel1 = "";
                }
                else
                {
                    _Channel1 = value;
                }
                OnPropertyChanged("Channel1");
            }
        }

        public object Channel2
        {
            get
            {
                return _Channel2;
            }
            set
            {
                if (value == null)
                {
                    _Channel2 = "";
                }
                else
                {
                    _Channel2 = value;
                }
                OnPropertyChanged("Channel2");
            }
        }

        public object Channel3
        {
            get
            {
                return _Channel3;
            }
            set
            {
                if (value == null)
                {
                    _Channel3 = "";
                }
                else
                {
                    _Channel3 = value;
                }
                OnPropertyChanged("Channel3");
            }
        }

        public object Channel4
        {
            get
            {
                return _Channel4;
            }
            set
            {
                if (value == null)
                {
                    _Channel4 = "";
                }
                else
                {
                    _Channel4 = value;
                }
                OnPropertyChanged("Channel4");
            }
        }

        public object Channel5
        {
            get
            {
                return _Channel5;
            }
            set
            {
                if (value == null)
                {
                    _Channel5 = "";
                }
                else
                {
                    _Channel5 = value;
                }
                OnPropertyChanged("Channel5");
            }
        }

        public object Channel6
        {
            get
            {
                return _Channel6;
            }
            set
            {
                if (value == null)
                {
                    _Channel6 = "";
                }
                else
                {
                    _Channel6 = value;
                }
                OnPropertyChanged("Channel6");
            }
        }

        public Color Color1
        {
            get
            {
                return _Color1;
            }
            set
            {
                if (!(_Color1 == value))
                {
                    _Color1 = value;
                    OnPropertyChanged("Color1");
                }
            }
        }

        public Color Color2
        {
            get
            {
                return _Color2;
            }
            set
            {
                if (!(_Color2 == value))
                {
                    _Color2 = value;
                    OnPropertyChanged("Color2");
                }
            }
        }

        public Color Color3
        {
            get
            {
                return _Color3;
            }
            set
            {
                if (!(_Color3 == value))
                {
                    _Color3 = value;
                    OnPropertyChanged("Color3");
                }
            }
        }

        public Color Color4
        {
            get
            {
                return _Color4;
            }
            set
            {
                if (!(_Color4 == value))
                {
                    _Color4 = value;
                    OnPropertyChanged("Color4");
                }
            }
        }

        public Color Color5
        {
            get
            {
                return _Color5;
            }
            set
            {
                if (!(_Color5 == value))
                {
                    _Color5 = value;
                    OnPropertyChanged("Color5");
                }
            }
        }

        public Color Color6
        {
            get
            {
                return _Color6;
            }
            set
            {
                if (!(_Color6 == value))
                {
                    _Color6 = value;
                    OnPropertyChanged("Color6");
                }
            }
        }

        public int TubeNo
        {
            get
            {
                return _TubeNo;
            }
            set
            {
                if (_TubeNo != value)
                {
                    _TubeNo = value;
                    for (int i = 1; i <= 6; i++)
                    {
                        SetColor(i, Utility.GetTargetColor(_TubeNo, i));
                    }
                }
            }
        }

        public AQTargetDataRow()
        {
        }

        public AQTargetDataRow(object objItem)
        {
            _ColumnItem = objItem;
        }

        public object GetObject(int idx)
        {
            switch (idx)
            {
                case 1:
                    return Channel1;
                case 2:
                    return Channel2;
                case 3:
                    return Channel3;
                case 4:
                    return Channel4;
                case 5:
                    return Channel5;
                case 6:
                    return Channel6;
                default:
                    return ColumnItem;
            }
        }

        public void SetValue(int idx, object obj)
        {
            switch (idx)
            {
                case 1:
                    Channel1 = obj;
                    break;
                case 2:
                    Channel2 = obj;
                    break;
                case 3:
                    Channel3 = obj;
                    break;
                case 4:
                    Channel4 = obj;
                    break;
                case 5:
                    Channel5 = obj;
                    break;
                case 6:
                    Channel6 = obj;
                    break;
                default:
                    ColumnItem = obj;
                    break;
            }
        }

        public Color GetColor(int idx)
        {
            switch (idx)
            {
                case 1:
                    return Color1;
                case 2:
                    return Color2;
                case 3:
                    return Color3;
                case 4:
                    return Color4;
                case 5:
                    return Color5;
                default:
                    return Color6;
            }
        }

        public void SetColor(int idx, Color color)
        {
            switch (idx)
            {
                case 1:
                    Color1 = color;
                    break;
                case 2:
                    Color2 = color;
                    break;
                case 3:
                    Color3 = color;
                    break;
                case 4:
                    Color4 = color;
                    break;
                case 5:
                    Color5 = color;
                    break;
                case 6:
                    Color6 = color;
                    break;
            }
        }

        public AQTargetDataRow(object obj0, object obj1, object obj2, object obj3, object obj4, object obj5, object obj6)
        {
            _ColumnItem = obj0;
            _Channel1 = obj1;
            _Channel2 = obj2;
            _Channel3 = obj3;
            _Channel4 = obj4;
            _Channel5 = obj5;
            _Channel6 = obj6;
        }
    }
}
